<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<input type="hidden" id="deviceId" th:value="*{boxbh}" name="deviceId">
    <form class="form-horizontal m" id="form-boxinfoDoor-edit" th:object="${boxinfoDoor}">
        <input id="doorGuid" name="doorGuid" th:field="*{doorGuid}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">柜口名称：</label>
            <div class="col-sm-8">
                <input id="doorName" name="doorName" readonly th:field="*{doorName}" class="form-control"
                       type="text">
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 control-label">占用情况：</label>
            <div class="col-sm-8">
               <select id="doorStatus" name="doorStatus"  th:field="*{doorStatus}" class="form-control">
						<option value ="0">空闲</option>
						<option value ="1">占用</option>			
						<option value ="2">打开</option>		
						<option value ="5">出错</option>					
					</select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">柜口分组：</label>
            <div class="col-sm-8">
                <input id="doorFz" name="doorFz" th:field="*{doorFz}" class="form-control" type="text">
                  
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">柜口编号：</label>
            <div class="col-sm-8">
                <input id="doorBh" name="doorBh" th:field="*{doorBh}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">柜口大小：</label>
            <div class="col-sm-8">
                <select id="doorType" name="doorType" class="form-control m-b"
                        th:with="type=${@dict.getType('ebox_door_size')}">
                    <option th:each="dict : ${type}" th:text="${dict['dictLabel']}"
                            th:value="${dict['dictValue']}" th:field="*{doorType}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">柜口状态：</label>
            <div class="col-sm-8">
                <select id="doorZt" name="doorZt" class="form-control m-b"
                        th:with="type=${@dict.getType('ebox_door_zt')}">
                    <option th:each="dict : ${type}" th:text="${dict['dictLabel']}"
                            th:value="${dict['dictValue']}" th:field="*{doorZt}"></option>
                </select>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 control-label">是否收费：</label>
            <div class="col-sm-8">
               <select id="doorSfsf" name="doorSfsf"  th:field="*{doorSfsf}" class="form-control">
						<option value ="0">不收费</option>
						<option value ="1">收费</option>						
					</select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">收费金额：</label>
            <div class="col-sm-8">
                <input id="doorSfje" name="doorSfje" th:field="*{doorSfje}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="submit" class="btn btn-primary">提交</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            <button onclick="sendopenlock()" class="btn btn-danger" type="button">开柜</button>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "ebox/boxinfoDoor"
    $("#form-boxinfoDoor-edit").validate({
        rules: {
            doorFz: {
                required: true
            },
            doorBh: {
                required: true
            }
        },
        submitHandler: function (form) {
            $.operate.saveAndReloadTableOnly(prefix + "/edit", $('#form-boxinfoDoor-edit').serialize());
        }
    });
	 function sendopenlock(){
		 
		 $.modal.confirm("确认要开起柜门吗?", function() {
 			var url = ctx +"api-v1/manager/sendKdgOpenBybh";
 			 var deviceId = $("#deviceId").val(); 			
 			 var fz=$("#doorFz").val();
 			 var bh=$("#doorBh").val();
 			var data = { "deviceId": deviceId,"fz":fz,"bh":bh };
 			
 			$.post(ctx + "api-v1/manager/sendKdgOpenBybh", {
 				deviceId:deviceId,fz:fz,bh:bh
				}, function(result) {
					
				}, 'json').error(function() {
				});
 		});
	 }
</script>
</body>
</html>
